package com.zhome.gateway.model;

import lombok.Data;

@Data
public class Result<T> {

    private int status;

    private String message;

    private T data;

    public  Result ok(T t) {
        this.status = 200;
        this.setData(t);
        return this;
    }

    public static Result error(String msg) {
        Result<String> result = new Result<>();
        result.status = 400;
        result.message = msg;
        return result;
    }

    public static Result innerError(String t) {
        Result<String> result = new Result<>();
        result.status = 500;
        result.message = t;
        return result;
    }

}
